﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RDIFramework.WebApp.TestModules
{
    public partial class CommitRepair  : BasePage
    {
        protected string organizeJSON = string.Empty;

        /// <summary>
        /// 添加员工权限
        /// </summary>
        private bool permissionAdd = false;

        /// <summary>
        /// 编辑员工权限
        /// </summary>
        private bool permissionEdit = false;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.GetPermission();
            }
        }       
        /// <summary>
        /// 获得权限
        /// </summary>
        private void GetPermission()
        {
            this.permissionAdd = this.IsAuthorized("StaffAdmin.Add");
            this.permissionEdit = this.IsAuthorized("StaffAdmin.Edit");
        }

        /// <summary>
        /// 加载工具栏
        /// </summary>
        /// <returns>工具栏HTML</returns>
        public override string BuildToolBarButtons()
        {
            StringBuilder sb = new StringBuilder();
            string linkbtn_template = "<a id=\"btn{0}\" class=\"easyui-linkbutton\" style=\"float:left\"  plain=\"true\" href=\"javascript:;\" icon=\"{1}\"  {2} title=\"{3}\">{4}</a>";
            sb.Append("<a id=\"btnRefresh\" class=\"easyui-linkbutton\" style=\"float:left\"  plain=\"true\" href=\"javascript:;\" icon=\"icon-reload\"  title=\"重新加载\">刷新</a> ");
            sb.Append("<div class='datagrid-btn-separator'></div> ");
            sb.Append(string.Format(linkbtn_template, "AddStaff", "icon-vcard_add", permissionAdd ? "" : "disabled=\"True\"", "添加员工", "添加"));
            sb.Append(string.Format(linkbtn_template, "EditStaff", "icon-vcard_edit", permissionEdit ? "" : "disabled=\"True\"", "修改员工", "修改"));

            return sb.ToString();
        }
    }
}